package com.hbnu.system.controller;

import com.hbnu.system.core.base.Rest;
import com.hbnu.system.model.entity.Work_Type;
import com.hbnu.system.model.vo.ChildrenNameId;
import com.hbnu.system.service.IWorkTypeSerivce;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/worktype")
@Api(tags = "著作类型数据模块")
public class WorkTypeController {
    @Autowired
    private IWorkTypeSerivce workTypeSerivce;

    @ApiOperation("著作类型数据单个查看")
    @GetMapping("/getWorkTypeByID")
    public Rest<Work_Type> getWorkTypeByID(String ID){
        Work_Type work_type = workTypeSerivce.checkOneWorkType(ID);

        return Rest.success(work_type);
    }

    @ApiOperation("著作类型数据总查看")
    @GetMapping("/getWorkTypes")
    public Rest<List<Work_Type>> getWorkPresses(){
        List<Work_Type> work_types = workTypeSerivce.checkWorkTypes();
        return Rest.success(work_types);
    }

    @ApiOperation("著作类型数据级联数据格式")
    @GetMapping("/getCascadingData")
    public Rest<List<ChildrenNameId>> getCascadingData(){
        List<ChildrenNameId> cascadingData = workTypeSerivce.getCascadingData();
        return Rest.success(cascadingData);
    }
}
